import Vue from "vue";
import VueRouter from "vue-router";
import NowPlaying from "../views/NowPlaying.vue";
import ComingSoon from "../views/ComingSoon.vue";

Vue.use(VueRouter);

const routes = [
  {
    path:"/",
    redirect:"/film/nowplaying",
  }
  ,
  {
    path: "/film",
    name: "film",
    component: () => import("../views/FilmView.vue"),
    redirect:"/film/nowplaying",
    children: [
      {
        path: "nowplaying",
        name: "nowplaying",
        component: NowPlaying,
      },
      {
        path: "comingsoon",
        name: "comingsoon",
        component: ComingSoon,
      },
    ],
  },
  {
    path: "/cinema",
    name: "cinema",
    component: () => import("../views/CinemaView.vue"),
  },
  {
    path: "/news",
    name: "news",
    component: () => import("../views/NewsView.vue"),
  },
  {
    path: "/mine",
    name: "mine",
    component: () => import("../views/MineView.vue"),
  },
  {
    path: "/test",
    name: "test",
    component: () => import("../views/TestView.vue"),
  },
  {
    path: "/filmdetail/:id",
    name: "filmdetail",
    component: () => import("../views/FilmDetail.vue"),
  },
  {
    path: "/filmbuy/:id",
    name: "filmbuy",
    component: () => import("../views/FilmBuy.vue"),
  },
];

const router = new VueRouter({
  routes,
});

export default router;
